import request from '@/utils/request';

// 登录方法
export function login(username, password) {
  const data = {
    username,
    password
  };
  return request({
    url: '/api/login/loginAs',
    method: 'post',
    data: data
  });
}

// 注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  });
}

// 退出方法
export function logout() {
  return request({
    url: '/api/orgm/logout',
    method: 'post'
  });
}

// 获取菜单
export async function getMenuApi(userId) {
  const data = await request({
    url: '/menu.json',
    method: 'get'
  });
  return {
    result: data
  };
}
